package org.iqiyi.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class MvcConfing implements WebMvcConfigurer {
    @Value("${file.path}")
    String path;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //当请求服务器中带有/imgs/的时候就是到指定路径中找出对应名字对应图片，其中**就代表匹配多层路径下的名字
        registry.addResourceHandler("/imgs/**").addResourceLocations("file:"+path+"/");
    }
}